#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
#include<vector>
using namespace std;

class Solution {
public:
    int myAtoi(string str) {
        int i = 0;
        int flag = 1;
        long res = 0;
        while (str[i] == ' ') i++;
        if (str[i] == '-')flag = -1;
        if (str[i] == '-' || str[i] == '+')i++;
        for (; i < str.size() && isdigit(str[i]); i++)
        {
            res = res * 10 + (str[i] - '0');
            if (res > INT_MAX && flag == 1)return INT_MAX;
            if (res > INT_MAX && flag == -1)return INT_MIN;
        }
        return flag * res;
    }

    string addStrings(string num1, string num2) {
        string str;
        int end1 = num1.size() - 1, end2 = num2.size() - 1;
        int next = 0;
        while (end1 >= 0 || end2 >= 0)
        {
            int val1 = end1 >= 0 ? num1[end1--] - '0' : 0;
            int val2 = end2 >= 0 ? num2[end2--] - '0' : 0;
            int ret = val1 + val2 + next;
            next = ret / 10;
            ret = ret % 10;

            str += ('0' + ret);
        }
        if (next != 0)
            str += '1';
        reverse(str.begin(), str.end());
        return str;
    }

    void reverseString(vector<char>& s) {
        reverse(s.begin(), s.end());
    }

    bool isPalindrome(string s) {
        string str;
        for (char ch : s)
        {
            if (isalnum(ch)) {
                str += tolower(ch);
            }
        }
        string str2(str.rbegin(), str.rend());
        return str2 == str;
    }

    string reverseStr(string s, int k) {
        int n = s.length();
        for (int i = 0; i < n; i += 2 * k)
        {
            reverse(s.begin() + i, s.begin() + min(i + k, n));
        }
        return s;
    }

};

int main() {
    string str;
    getline(cin, str);
    size_t pos = str.rfind(" ");
    cout << str.size() - (pos + 1) << endl;
}